/* ================================================================
solvling Ax = b for poisson equation, using KSP of PETSc package
ref: petsc-3.8.3/src/ksp/ksp/examples/tutorials/ex2.c
==================================================================*/
#ifdef enable_superlu

#ifndef SolverSuperLU_H
#define SolverSuperLU_H

#include "Solver.h"
#include "Equation/Matrix.h"
#include "slu_ddefs.h"

class SolverSuperLU : public Solver
{

public:

    SolverSuperLU(math::SMatrix* A_, math::Vector* b_, math::Vector* x_);
    virtual ~SolverSuperLU();

    virtual void operator()();
    void solve();
    void finish();
    void init();

    math::SMatrix* A;
    math::Vector* b;
    math::Vector* x;

    WallTime* wall_time0;
    WallTime* wall_time1;

protected:

    char           equed[1];
    yes_no_t       equil;
    trans_t        trans;
    SuperMatrix    lu_A, lu_L, lu_U;
    SuperMatrix    lu_B, lu_X;
    NCformat       *Astore;
    NCformat       *Ustore;
    SCformat       *Lstore;
    GlobalLU_t	   Glu;
    double         *a;
    int            *asub, *xa;
    int            *perm_c; /* column permutation vector */
    int            *perm_r; /* row permutations from partial pivoting */
    int            *etree;
    void           *work;
    int            info, lwork, nrhs, ldx;
    int            m, n, nnz;
    double         *rhsb, *rhsx, *xact;
    double         *R, *C;
    double         *ferr, *berr;
    double         u, rpg, rcond;
    mem_usage_t    mem_usage;
    superlu_options_t options;
    SuperLUStat_t stat;







};

#endif

#endif